gdkwindow: Allow gdk_window_set_opacity on non-native children
authorAlexander Larsson <alexl@redhat.com>
Wed, 7 Nov 2012 12:03:32 +0000 (13:03 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 7 Feb 2013 10:11:37 +0000 (11:11 +0100)
commit4d3c77f9200dbdfa71e2aaa390d11e88099b5c6e
tree86cb6b83b74f7cde4a1b2a70729d47bcccec525a
parentada6d81247fc1dac9d5cbadbd343e25c11da939f
gdkwindow: Allow gdk_window_set_opacity on non-native children

We now store the current opacity for all windows. For native windows
we just call into the native implementation whenever the opacity changes.
However, for non-native windows we implement opacity by pushing a
second implicit paint that "stacks" on the existing one, acting as
an opacity group while rendering the window and its children.

This works well in general, although any native child windows will of
course not be opaque. However, there is no way to implement
implicit paint flushing (i.e. draw the currently drawn double buffer
to the window in order to allow direct drawing to the window).
We can't flush in the stacked implicit paint case because there
is no way to get the right drawing behaviour when drawing directly
to the window. We *must* draw to the opacity group to get the right
behaviour.

We currently flush if:
* A widget disables double buffering
* You call move/resize/scroll a window and it has non-native children
  during the expose handler

In case this happens we warn and flush the outermost group, so there may
be drawing errors.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
gdk/gdkinternals.h
gdk/gdkwindow.c